<?php
include('class/class_connect.php');
include('class/class_page.php');
include('class/class_news.php');
include('class/tabs/class_tabs.php');
include('class/class_address.php');
include('class/class_rating.php');
include('class/abstract/class_mainObjectInfo.php');
include('class/city_rus.php');
include('class/class_checkGetData.php');

if (!preg_match('//u', $_GET['division'])) 
	$_GET['division'] = iconv('windows-1251', 'UTF-8', $_GET['division']);
session_start();
class aFirmPage extends page
{
	function __construct()
	{
    	parent::__construct();
	}
	function title()
	{
    	$city_rus=new city_rus_class();
    	echo $_GET['division'].' '.$city_rus->city_rus_im($_GET['city']);
	}
	function maincontent()
	{
		$city=$_GET['city'];
		$division=$_GET['division'];
		$city_rus=new city_rus_class();
		include('includes/rubriks.php');
		echo ('
			<link rel="stylesheet" type="text/css" href="style/division.css" />
			<div class="route">
				<div class="routeEl">
					<a href="index.php?city='.$city.'">'.$city_rus->city_rus_im($city).'</a>
				</div>
				<div class="routeEl">
					'.$division.'
				</div>
			</div>
			<div class="division">
				<table>
				');

		$connect=new connect('f');
		for($i=0; $i<count($divises[$division]); $i++)
			{
				$subdiv=$divises[$division][$i];
				$query="SELECT count(*) as 'count' FROM ".$_GET['city']." WHERE subdiv='$subdiv'";
				$res=mysql_query($query) or die(mysql_error());
				$row=mysql_fetch_array($res);
				$subdiv_link=str_replace(' ','+',$subdiv);
				echo ('

					<tr height="30">
						<td  width="400" align="center">
							<a class="subdivLink" href="firms_list.php?subdiv='.$subdiv_link.'&city='.$city.'">
							'.$subdiv.'
							</a>('.$row['count'].')
						</td>
					</tr>

				');
			}
		echo ('
				</table>
			</div>
		');
	}
}



$aPage=new aFirmPage();

?>